Skip to content

Instantly share code, notes, and snippets.

@atheiman
atheiman / ssm_offline_instances.py
Created September 8, 2020 22:59
Dump EC2 instances that do not have SSM PingStatus of 'Online'
import boto3
import json
region = "us-gov-west-1"
all_instance_ids = [
i.id for i in boto3.resource("ec2", region_name=region).instances.all()
]
ssm_inst_paginator = boto3.client("ssm", region_name=region).get_paginator(
@PurpleVibe32
PurpleVibe32 / vmwk17key.txt
Last active May 21, 2024 12:06
Free VMware Workstation Pro 17 full license keys
Install VMWare Workstation PRO 17 (Read it right. PRO!)
Also, these keys might also work with VMWare Fusion 13 PRO. Just tested it.
Sub to me on youtube pls - PurpleVibe32
if you want more keys - call my bot on telegram. @purector_bot (THE BOT WONT REPLY ANYMORE) - Or: https://cdn.discordapp.com/attachments/1040615179894935645/1074016373228978277/keys.zip - the password in the zip is 102me.
---
This gist can get off at any time.
PLEASE, DONT COPY THIS. IF YOU FORK IT, DONT EDIT IT.
*If you have a problem comment and people will try to help you!
*No virus
@atheiman
atheiman / Cfn-Stack.yml
Last active May 21, 2024 12:05
Run command across accounts and regions with SSM
AWSTemplateFormatVersion: '2010-09-09'
Description: >
SSM Automation Document run a custom SSM Command Document
against a fleet of target instances.
Parameters:
AutomationDocumentName:
Type: String
Description: Name of created SSM Automation Document
Default: MyAutomation
@rambabusaravanan
rambabusaravanan / apache.conf
Last active May 21, 2024 12:02
SPA - Apache, Nginx Configuration for Single Page Application like React.js on a custom path
# To host on root path just use "<Location />" for http://mydomainname.in
# To host on non-root path use "<Location /myreactapp>" for http://mydomainname.in/mypath
# If non-root path, don't forgot to add "homepage": "/myreactapp" in your app's package.json
<VirtualHost *:80>
ServerName mydomainname.in
DirectoryIndex index.html
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
@atheiman
atheiman / script.py
Created November 9, 2023 21:51
Convert python dictionary of many levels to single level dictionary with dot notation keys
def dict_dot_notation(d, path=[]):
d2 = {}
for k, v in d.items():
k_path = path + [str(k)]
k_formatted = ".".join(k_path)
if isinstance(v, dict):
# merge in dict with recursive call
d2 = {**d2, **dict_dot_notation(v, path=k_path)}
elif isinstance(v, list) or isinstance(v, tuple):
@atheiman
atheiman / security_hub_findings_query.py
Last active May 21, 2024 12:00
Security Hub findings querying and batch updating with boto3. Suppress sample findings (i.e. from GuardDuty "CreateSampleFindings").
#!/usr/bin/env python
import boto3
import json
sechub = boto3.client("securityhub")
sts = boto3.client("sts")
caller_arn = sts.get_caller_identity()["Arn"]
print(caller_arn)
@atheiman
atheiman / aws_switch_role_bookmark_generator.py
Last active May 21, 2024 11:59
AWS organization switch role (assume role) bookmark generator - outputs html to stdout that can be saved to a .html file and imported into browser bookmarks.
import boto3
import os
# Environment variables for configuration
role_name = os.environ.get("ROLE_NAME", "OrganizationAccountAccessRole")
include_mgmt = os.environ.get("INCLUDE_MGMT", "true").lower() == "true"
sts = boto3.client("sts")
caller_arn = sts.get_caller_identity()["Arn"]
partition = caller_arn.split(":")[1]
@atheiman
atheiman / docker-image-share.sh
Created May 21, 2024 01:55
Package and share docker image
# Package docker image to .tar.gz to share to another machine
docker pull alpine
docker save alpine | gzip > alpine.tar.gz
# Load docker image from .tar.gz
docker load < alpine.tar.gz
# Show loaded image
docker image ls alpine
# REPOSITORY TAG IMAGE ID CREATED SIZE
@Sirpyerre
Sirpyerre / Dockerfile
Last active May 21, 2024 11:58
Dockerfile Laravel SQL SERVER
FROM ubuntu:21.10
LABEL maintainer="Taylor Otwell"
ARG WWWGROUP
WORKDIR /var/www/html
ENV DEBIAN_FRONTEND noninteractive
ENV TZ=UTC
@serif
serif / bwclean2.py
Last active May 21, 2024 11:57
Bitwarden Duplicate Entry Remover v2
#!/usr/bin/env python3
# updated 2023-11-27
# updated 2023-10-12
# updated 2021
# updated 2020
# created 2018
import sys
import hashlib
from urllib.parse import urlparse